package com.example.mvp.activity

import android.os.Bundle
import android.view.View
import cn.jzvd.JZVideoPlayer
import com.example.baselibrary.R
import com.example.mvp.binder.BaseDataBinder
import com.example.mvp.binder.DataBinder
import com.example.mvp.delegate.VideoPlayerDelegate
import com.example.util.BCFinalist

/**
 * 视频播放
 * @author  chaohaipeng  on 2018/7/20.
 */
class VideoPlayerActivity : BaseActivityMVP<VideoPlayerDelegate>() {
    override fun bindEvenListener() {
        viewDelegate.setOnClickListener(View.OnClickListener {
            finish()

        }, R.id.iv_avp_video_back)

    }

    override fun initView(p0: Bundle?) {


    }

    override fun initDate() {
        val intent = intent
        val path = intent?.getStringExtra(BCFinalist.PATH_VIDEO_PATH)
        viewDelegate.playerVideo(path)

    }

    override fun getDelegateClass(): Class<VideoPlayerDelegate> {
        return VideoPlayerDelegate::class.java
    }

    override fun getDataBinder(): BaseDataBinder<*, *> {
        return DataBinder()

    }

    override fun onPause() {
        super.onPause()
      JZVideoPlayer.releaseAllVideos()
    }
}